package com.example.cacheredis.controller;

import com.example.cacheredis.pojo.Department;
import com.example.cacheredis.service.DeptService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

import javax.xml.ws.soap.Addressing;
import java.util.List;

@RestController
public class DeptController {

    @Autowired
    DeptService deptService;

    @GetMapping("/getAllDept")
    public List<Department> getAllDept() {
        return this.deptService.findAllDept();
    }

    @GetMapping("/getDeptById/{departmentId}")
    public Department getDeptById(@PathVariable Integer departmentId){
        return this.deptService.findDeptById(departmentId);
    }

}
